async function sleep(ms) {  
    return new Promise(resolve => setTimeout(resolve, ms));  
}

/**
 * 
 * @param {Array<Date>} searchAskForLeave 
 */
function getStartAndEndTime(searchAskForLeave) {

    if (!searchAskForLeave) {
        return [];
    }

    let dateStart =  searchAskForLeave[0];

    dateStart.setHours(0, 0, 0, 0);  
    let  endTime = searchAskForLeave[1];

    endTime.setHours(23, 59, 59, 999);  
    return [
        parseInt(dateStart.getTime() /1000),
        parseInt(endTime.getTime() / 1000)
    ];

}


export {
    getStartAndEndTime,
    sleep
}